Optimal. Leaf size=120 \[ -\frac {b (e f-d g)^2 n x}{3 e^2}-\frac {b (e f-d g) n (f+g x)^2}{6 e g}-\frac {b n (f+g x)^3}{9 g}-\frac {b (e f-d g)^3 n \log (d+e x)}{3 e^3 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 120, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 22, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {2442, 45}
\begin {gather*} \frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac {b n (e f-d g)^3 \log (d+e x)}{3 e^3 g}-\frac {b n x (e f-d g)^2}{3 e^2}-\frac {b n (f+g x)^2 (e f-d g)}{6 e g}-\frac {b n (f+g x)^3}{9 g} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 2442
Rubi steps
\begin {align*} \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx &=\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac {(b e n) \int \frac {(f+g x)^3}{d+e x} \, dx}{3 g}\\ &=\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac {(b e n) \int \left (\frac {g (e f-d g)^2}{e^3}+\frac {(e f-d g)^3}{e^3 (d+e x)}+\frac {g (e f-d g) (f+g x)}{e^2}+\frac {g (f+g x)^2}{e}\right ) \, dx}{3 g}\\ &=-\frac {b (e f-d g)^2 n x}{3 e^2}-\frac {b (e f-d g) n (f+g x)^2}{6 e g}-\frac {b n (f+g x)^3}{9 g}-\frac {b (e f-d g)^3 n \log (d+e x)}{3 e^3 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.10, size = 150, normalized size = 1.25 \begin {gather*} \frac {6 b d^2 g (-3 e f+d g) n \log (d+e x)+e \left (x \left (6 a e^2 \left (3 f^2+3 f g x+g^2 x^2\right )-b n \left (6 d^2 g^2-3 d e g (6 f+g x)+e^2 \left (18 f^2+9 f g x+2 g^2 x^2\right )\right )\right )+6 b e \left (3 d f^2+e x \left (3 f^2+3 f g x+g^2 x^2\right )\right ) \log \left (c (d+e x)^n\right )\right )}{18 e^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [C] Result contains higher order function than in optimal. Order 9 vs. order
3.
time = 0.37, size = 585, normalized size = 4.88
method | result | size |
risch | \(-\frac {i g^{2} \pi b \,x^{3} \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{3}}{6}-\frac {i \pi b \,f^{2} x \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{3}}{2}+\frac {a \,g^{2} x^{3}}{3}+\frac {b \,f^{2} n d \ln \left (e x +d \right )}{e}+\frac {\left (g x +f \right )^{3} b \ln \left (\left (e x +d \right )^{n}\right )}{3 g}+x a \,f^{2}-b \,f^{2} n x +\frac {g^{2} b d n \,x^{2}}{6 e}+\frac {g^{2} \ln \left (c \right ) b \,x^{3}}{3}+\ln \left (c \right ) b \,f^{2} x +\frac {g b d f n x}{e}-\frac {g \ln \left (e x +d \right ) b \,d^{2} f n}{e^{2}}+\frac {i g \pi b f \,x^{2} \mathrm {csgn}\left (i \left (e x +d \right )^{n}\right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{2}+\frac {i g \pi b f \,x^{2} \mathrm {csgn}\left (i c \right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{2}-\frac {i \pi b \,f^{2} x \,\mathrm {csgn}\left (i c \right ) \mathrm {csgn}\left (i \left (e x +d \right )^{n}\right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )}{2}-\frac {i g^{2} \pi b \,x^{3} \mathrm {csgn}\left (i c \right ) \mathrm {csgn}\left (i \left (e x +d \right )^{n}\right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )}{6}-\frac {g^{2} b n \,x^{3}}{9}+g a f \,x^{2}+g \ln \left (c \right ) b f \,x^{2}-\frac {\ln \left (e x +d \right ) b \,f^{3} n}{3 g}+\frac {i \pi b \,f^{2} x \,\mathrm {csgn}\left (i \left (e x +d \right )^{n}\right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{2}+\frac {i \pi b \,f^{2} x \,\mathrm {csgn}\left (i c \right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{2}-\frac {i g \pi b f \,x^{2} \mathrm {csgn}\left (i c \right ) \mathrm {csgn}\left (i \left (e x +d \right )^{n}\right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )}{2}-\frac {g b f n \,x^{2}}{2}-\frac {g^{2} b \,d^{2} n x}{3 e^{2}}+\frac {g^{2} \ln \left (e x +d \right ) b \,d^{3} n}{3 e^{3}}+\frac {i g^{2} \pi b \,x^{3} \mathrm {csgn}\left (i \left (e x +d \right )^{n}\right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{6}+\frac {i g^{2} \pi b \,x^{3} \mathrm {csgn}\left (i c \right ) \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{6}-\frac {i g \pi b f \,x^{2} \mathrm {csgn}\left (i c \left (e x +d \right )^{n}\right )^{3}}{2}\) | \(585\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 190, normalized size = 1.58 \begin {gather*} \frac {1}{3} \, b g^{2} x^{3} \log \left ({\left (x e + d\right )}^{n} c\right ) + \frac {1}{3} \, a g^{2} x^{3} + {\left (d e^{\left (-2\right )} \log \left (x e + d\right ) - x e^{\left (-1\right )}\right )} b f^{2} n e - \frac {1}{2} \, {\left (2 \, d^{2} e^{\left (-3\right )} \log \left (x e + d\right ) + {\left (x^{2} e - 2 \, d x\right )} e^{\left (-2\right )}\right )} b f g n e + \frac {1}{18} \, {\left (6 \, d^{3} e^{\left (-4\right )} \log \left (x e + d\right ) - {\left (2 \, x^{3} e^{2} - 3 \, d x^{2} e + 6 \, d^{2} x\right )} e^{\left (-3\right )}\right )} b g^{2} n e + b f g x^{2} \log \left ({\left (x e + d\right )}^{n} c\right ) + a f g x^{2} + b f^{2} x \log \left ({\left (x e + d\right )}^{n} c\right ) + a f^{2} x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.36, size = 195, normalized size = 1.62 \begin {gather*} -\frac {1}{18} \, {\left (6 \, b d^{2} g^{2} n x e - 6 \, {\left (b g^{2} x^{3} + 3 \, b f g x^{2} + 3 \, b f^{2} x\right )} e^{3} \log \left (c\right ) + {\left (2 \, {\left (b g^{2} n - 3 \, a g^{2}\right )} x^{3} + 9 \, {\left (b f g n - 2 \, a f g\right )} x^{2} + 18 \, {\left (b f^{2} n - a f^{2}\right )} x\right )} e^{3} - 3 \, {\left (b d g^{2} n x^{2} + 6 \, b d f g n x\right )} e^{2} - 6 \, {\left (b d^{3} g^{2} n - 3 \, b d^{2} f g n e + 3 \, b d f^{2} n e^{2} + {\left (b g^{2} n x^{3} + 3 \, b f g n x^{2} + 3 \, b f^{2} n x\right )} e^{3}\right )} \log \left (x e + d\right )\right )} e^{\left (-3\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 252 vs.
\(2 (102) = 204\).
time = 0.69, size = 252, normalized size = 2.10 \begin {gather*} \begin {cases} a f^{2} x + a f g x^{2} + \frac {a g^{2} x^{3}}{3} + \frac {b d^{3} g^{2} \log {\left (c \left (d + e x\right )^{n} \right )}}{3 e^{3}} - \frac {b d^{2} f g \log {\left (c \left (d + e x\right )^{n} \right )}}{e^{2}} - \frac {b d^{2} g^{2} n x}{3 e^{2}} + \frac {b d f^{2} \log {\left (c \left (d + e x\right )^{n} \right )}}{e} + \frac {b d f g n x}{e} + \frac {b d g^{2} n x^{2}}{6 e} - b f^{2} n x + b f^{2} x \log {\left (c \left (d + e x\right )^{n} \right )} - \frac {b f g n x^{2}}{2} + b f g x^{2} \log {\left (c \left (d + e x\right )^{n} \right )} - \frac {b g^{2} n x^{3}}{9} + \frac {b g^{2} x^{3} \log {\left (c \left (d + e x\right )^{n} \right )}}{3} & \text {for}\: e \neq 0 \\\left (a + b \log {\left (c d^{n} \right )}\right ) \left (f^{2} x + f g x^{2} + \frac {g^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 430 vs.
\(2 (112) = 224\).
time = 4.13, size = 430, normalized size = 3.58 \begin {gather*} \frac {1}{3} \, {\left (x e + d\right )}^{3} b g^{2} n e^{\left (-3\right )} \log \left (x e + d\right ) - {\left (x e + d\right )}^{2} b d g^{2} n e^{\left (-3\right )} \log \left (x e + d\right ) + {\left (x e + d\right )} b d^{2} g^{2} n e^{\left (-3\right )} \log \left (x e + d\right ) - \frac {1}{9} \, {\left (x e + d\right )}^{3} b g^{2} n e^{\left (-3\right )} + \frac {1}{2} \, {\left (x e + d\right )}^{2} b d g^{2} n e^{\left (-3\right )} - {\left (x e + d\right )} b d^{2} g^{2} n e^{\left (-3\right )} + {\left (x e + d\right )}^{2} b f g n e^{\left (-2\right )} \log \left (x e + d\right ) - 2 \, {\left (x e + d\right )} b d f g n e^{\left (-2\right )} \log \left (x e + d\right ) + \frac {1}{3} \, {\left (x e + d\right )}^{3} b g^{2} e^{\left (-3\right )} \log \left (c\right ) - {\left (x e + d\right )}^{2} b d g^{2} e^{\left (-3\right )} \log \left (c\right ) + {\left (x e + d\right )} b d^{2} g^{2} e^{\left (-3\right )} \log \left (c\right ) - \frac {1}{2} \, {\left (x e + d\right )}^{2} b f g n e^{\left (-2\right )} + 2 \, {\left (x e + d\right )} b d f g n e^{\left (-2\right )} + \frac {1}{3} \, {\left (x e + d\right )}^{3} a g^{2} e^{\left (-3\right )} - {\left (x e + d\right )}^{2} a d g^{2} e^{\left (-3\right )} + {\left (x e + d\right )} a d^{2} g^{2} e^{\left (-3\right )} + {\left (x e + d\right )} b f^{2} n e^{\left (-1\right )} \log \left (x e + d\right ) + {\left (x e + d\right )}^{2} b f g e^{\left (-2\right )} \log \left (c\right ) - 2 \, {\left (x e + d\right )} b d f g e^{\left (-2\right )} \log \left (c\right ) - {\left (x e + d\right )} b f^{2} n e^{\left (-1\right )} + {\left (x e + d\right )}^{2} a f g e^{\left (-2\right )} - 2 \, {\left (x e + d\right )} a d f g e^{\left (-2\right )} + {\left (x e + d\right )} b f^{2} e^{\left (-1\right )} \log \left (c\right ) + {\left (x e + d\right )} a f^{2} e^{\left (-1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.27, size = 212, normalized size = 1.77 \begin {gather*} x^2\,\left (\frac {g\,\left (a\,d\,g+2\,a\,e\,f-b\,e\,f\,n\right )}{2\,e}-\frac {d\,g^2\,\left (3\,a-b\,n\right )}{6\,e}\right )+x\,\left (\frac {3\,a\,e\,f^2-3\,b\,e\,f^2\,n+6\,a\,d\,f\,g}{3\,e}-\frac {d\,\left (\frac {g\,\left (a\,d\,g+2\,a\,e\,f-b\,e\,f\,n\right )}{e}-\frac {d\,g^2\,\left (3\,a-b\,n\right )}{3\,e}\right )}{e}\right )+\ln \left (c\,{\left (d+e\,x\right )}^n\right )\,\left (b\,f^2\,x+b\,f\,g\,x^2+\frac {b\,g^2\,x^3}{3}\right )+\frac {g^2\,x^3\,\left (3\,a-b\,n\right )}{9}+\frac {\ln \left (d+e\,x\right )\,\left (b\,n\,d^3\,g^2-3\,b\,n\,d^2\,e\,f\,g+3\,b\,n\,d\,e^2\,f^2\right )}{3\,e^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________